#coding:utf-8
import subprocess
WS_DIR = 'D:/Programs/SEIMS/data/youwuzhen/workspace/'
preprocess_pyfile = './preprocess/db_import_model_parameters.py'
preprocess_ini = WS_DIR + 'preprocess.ini'
run_seims_pyfile = 'run_seims.py'
run_seims_ini = WS_DIR + 'runmodel.ini'
postprocess_pyfile = './postprocess/main.py'
postprocess_ini = WS_DIR + 'postprocess.ini'

exec_preprocess = 'python {} -ini {}'.format(preprocess_pyfile, preprocess_ini)
exec_run_seims = 'python {} -ini {}'.format(run_seims_pyfile, run_seims_ini)
exec_postprocess = 'python {} -ini {}'.format(postprocess_pyfile, postprocess_ini)
try:
    subprocess.run(exec_preprocess, shell=True, check=True)
    subprocess.run(exec_run_seims, shell=True, check=True)
    subprocess.run(exec_postprocess, shell=True, check=True)
except subprocess.CalledProcessErroras as err:
    print('ERROR', err)
